package tsg.util;

public class ObjectUtilities 
{	
	@SuppressWarnings("unchecked")
	public static <T> T denullify(T object, Class<?> objectClass)
	{
		T result = object;
		
		
		if(result == null)
		{
			try {
				result = (T) objectClass.newInstance();
			} catch (InstantiationException e) {
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				e.printStackTrace();
			}
		}
		
		return result;
	}
	
}
